<?php

class UserAccessController extends AppController {

	function edit($user_id = null) {
	
		if ( empty($this->request->data) ) {
			//echo $user_id;
			$this->request->data = $this->UserAccess->find('all',
				array(
    				'conditions' => array('UserAccess.user_id' => $user_id)
    				));
		}	
		
		//$user_access = ClassRegistry::init('Functionality')->find('all', array());
		$user_access = ClassRegistry::init('Feature')->find('all', array());
		//$this->Functionality->find('all');

		/*
		if ( $this->request->is('post') ) {
			//$this->Role->save( $this->request->data );
			//$role_id = $this->Role->id;
			//
			//$count=0;
			foreach($this->request->data['RoleFunction'] as $index => $role_function) {
				
				$this->request->data['RoleFunction']['role_id'] = $role_id;
				$this->request->data['RoleFunction']['function_id'] = $this->request->data['RoleFunction'][$count]['function_id']; 				
				$this->loadModel('RoleFunction');
				$this->RoleFunction->create();
				$this->RoleFunction->save( $this->request->data );

				$count++;
				
			}
			//$this->redirect('/ledgers');

		}*/
		
		//pr($this->request->data);
		//echo $this->request->data['UserAccess']['user_id'];
		//echo $this->request->data['UserAccess']['module_id'];
		
		//$user_access['module1'] = array('read',0);
		//$user_access['module1'] = array('view',1);
		$this->set('user_access', $user_access);

	}
}

?>